import React from "react";
import { Route, BrowserRouter as Router, Switch, withRouter, Redirect } from "react-router-dom";
import Container from "../Content/MainContent";
import Discover from "../Content/Discover";
import Mine from "../Content/Mine";
import Friend from "../Content/Friend";
import Shop from "../Content/Shop";
import Musician from "../Content/Musician";
import Download from "../Content/Download";
import NotFound from "../Content/NotFound";
import SongDetail from '../Content/Discover/SongDetail'
import DiscoverRoutes from "../Routes/discoverRouter";

export default withRouter(function Routes(props) {

  return (
    // <Router>
    <Switch>
      <Route
        exact
        path="/"
        render={() => (
          <Discover>
            <DiscoverRoutes />
          </Discover>
        )}
      ></Route>
      <Route
        path="/discover"
        render={() => (
          <Discover>
            <DiscoverRoutes />
          </Discover>
        )}
      ></Route>
      <Route path="/mine" component={Mine} />
      <Route path="/friend" component={Friend} />
      <Route path="/shop" component={Shop} />
      <Route path="/musician" component={Musician} />
      <Route path="/download" component={Download} />
      <Route path="/404" component={NotFound} />
      <Route exact path="/song/:id/:type" component={SongDetail}></Route>
      <Redirect from="*" to="/404"></Redirect> //最末尾的重定向操作,后面不能插入其他路由
    </Switch>
    // </Router>
  );
})
